package com.qf.controller;

import com.qf.pojo.User;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
/**
 * 演示RestFul风格传参
 * RestFul风格是指浏览器url地址的风格, 不允许问号传参. 请求按照严格的请求类型来划分
 * @author 千锋健哥
 */
@RestController
@RequestMapping("/rest")
public class TestRestController {

    /**
     * 查询用户
     * http://localhost:8080/rest/findUser/zhangsan/18
     * @param name
     * @param age
     * @return
     */
    @GetMapping("/findUser/{xxx}/{age}")
    public List<User> findUser(@PathVariable(value = "xxx") String name,
                               @PathVariable(value = "age") Integer age) {
        System.out.println("===name===" + name);
        System.out.println("===age===" + age);
        return new ArrayList<User>();
    }
}
